package com.tpshion.cloud.auth.domain.dto;

import org.springframework.util.StringUtils;

import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

/**
 * 获取菜单树
 */
@Valid
public class MenuDto {

    @NotEmpty(message = "userId不能为空")
    @Size(max = 64, message = "userId长度不能超过64位")
    private String userId;

    private String sysCode;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getSysCode() {
        return sysCode;
    }

    public void setSysCode(String sysCode) {
        this.sysCode = sysCode;
    }

    @Override
    public String toString() {
        return "MenuDto{" +
                "userId='" + userId + '\'' +
                ", sysCode='" + sysCode + '\'' +
                '}';
    }

    public void init(){
        this.userId = StringUtils.isEmpty(this.userId) ? this.userId : this.userId.trim();
        this.sysCode = StringUtils.isEmpty(this.sysCode) ? this.sysCode : this.sysCode.trim();
    }
}
